package com.changgou.common;

import lombok.ToString;

@ToString
public enum CommonCode implements ResultCode {
    USERNAME_ERROR(false,204,"用户名错误"),
    PASSWORD_ERROR(false,205,"密码错误"),
    SUCCESS(true,200,"操作成功"),
    FAIL(false,203,"操作失败"),
    SERVER_ERROR(false,9999,"抱歉，系统繁忙，请稍后再试"),
    PARAMS_ISNOTNULL(false,204,"请求参数不能为空"),
    REDIS_SERVER_ERROE(false,301,"Redis服务器异常"),
    KAPTCHA_ERROR(false,602,"验证码错误"),
    VAILDATEEXPIRE(false,601,"验证码失效"),
    REPETITIVE_OPERATION(false,701,"请勿重复登录");


    boolean success;
    int code;
    String message;

    private CommonCode(boolean success, int code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }

    @Override
    public boolean success() {
        return success;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String message() {
        return message;
    }
}
